﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 3.1
// Code is generated on: Thursday, June 23, 2011 1:28:25 PM
// Code is generated using templates: SD.TemplateBindings.SharedTemplates.NET20
// Templates vendor: Solutions Design.
// Templates version: 
//////////////////////////////////////////////////////////////
using System;
using System.Collections.Generic;
using MyHealthOnline.Dal.Generated.HelperClasses;

using MyHealthOnline.Dal.Generated.EntityClasses;
using MyHealthOnline.Dal.Generated.RelationClasses;
using MyHealthOnline.Dal.Generated.DaoClasses;
using MyHealthOnline.Dal.Generated.CollectionClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

namespace MyHealthOnline.Dal.Generated.FactoryClasses
{
	// __LLBLGENPRO_USER_CODE_REGION_START AdditionalNamespaces
	// __LLBLGENPRO_USER_CODE_REGION_END
	
	/// <summary>general base class for the generated factories</summary>
	[Serializable]
	public partial class EntityFactoryBase : EntityFactoryCore
	{
		private readonly MyHealthOnline.Dal.Generated.EntityType _typeOfEntity;
		
		/// <summary>CTor</summary>
		/// <param name="entityName">Name of the entity.</param>
		/// <param name="typeOfEntity">The type of entity.</param>
		public EntityFactoryBase(string entityName, MyHealthOnline.Dal.Generated.EntityType typeOfEntity) : base(entityName)
		{
			_typeOfEntity = typeOfEntity;
		}

		/// <summary>Creates a new entity instance using the GeneralEntityFactory in the generated code, using the passed in entitytype value</summary>
		/// <param name="entityTypeValue">The entity type value of the entity to create an instance for.</param>
		/// <returns>new IEntity instance</returns>
		public override IEntity CreateEntityFromEntityTypeValue(int entityTypeValue)
		{
			return GeneralEntityFactory.Create((MyHealthOnline.Dal.Generated.EntityType)entityTypeValue);
		}
		
		/// <summary>Creates, using the generated EntityFieldsFactory, the IEntityFields object for the entity to create. </summary>
		/// <returns>Empty IEntityFields object.</returns>
		public override IEntityFields CreateFields()
		{
			return EntityFieldsFactory.CreateEntityFieldsObject(_typeOfEntity);
		}

		/// <summary>Creates the relations collection to the entity to join all targets so this entity can be fetched. </summary>
		/// <param name="objectAlias">The object alias to use for the elements in the relations.</param>
		/// <returns>null if the entity isn't in a hierarchy of type TargetPerEntity, otherwise the relations collection needed to join all targets together to fetch all subtypes of this entity and this entity itself</returns>
		public override IRelationCollection CreateHierarchyRelations(string objectAlias) 
		{
			return InheritanceInfoProviderSingleton.GetInstance().GetHierarchyRelations(ForEntityName, objectAlias);
		}

		/// <summary>This method retrieves, using the InheritanceInfoprovider, the factory for the entity represented by the values passed in.</summary>
		/// <param name="fieldValues">Field values read from the db, to determine which factory to return, based on the field values passed in.</param>
		/// <param name="entityFieldStartIndexesPerEntity">indexes into values where per entity type their own fields start.</param>
		/// <returns>the factory for the entity which is represented by the values passed in.</returns>
		public override IEntityFactory GetEntityFactory(object[] fieldValues, Dictionary<string, int> entityFieldStartIndexesPerEntity)
		{
			return (IEntityFactory)InheritanceInfoProviderSingleton.GetInstance().GetEntityFactory(ForEntityName, fieldValues, entityFieldStartIndexesPerEntity) ?? this;
		}
						
		/// <summary>Creates a new entity collection for the entity of this factory.</summary>
		/// <returns>ready to use new entity collection, typed.</returns>
		public override IEntityCollection CreateEntityCollection()
		{
			return GeneralEntityCollectionFactory.Create(_typeOfEntity);
		}
	}
	
	/// <summary>Factory to create new, empty AdministratorEntity objects.</summary>
	[Serializable]
	public partial class AdministratorEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public AdministratorEntityFactory() : base("AdministratorEntity", MyHealthOnline.Dal.Generated.EntityType.AdministratorEntity) { }

		/// <summary>Creates a new, empty AdministratorEntity object.</summary>
		/// <returns>A new, empty AdministratorEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new AdministratorEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewAdministrator
			// __LLBLGENPRO_USER_CODE_REGION_END
			
			return toReturn;
		}


		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty AppProposalEntity objects.</summary>
	[Serializable]
	public partial class AppProposalEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public AppProposalEntityFactory() : base("AppProposalEntity", MyHealthOnline.Dal.Generated.EntityType.AppProposalEntity) { }

		/// <summary>Creates a new, empty AppProposalEntity object.</summary>
		/// <returns>A new, empty AppProposalEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new AppProposalEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewAppProposal
			// __LLBLGENPRO_USER_CODE_REGION_END
			
			return toReturn;
		}


		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty ConsultEntity objects.</summary>
	[Serializable]
	public partial class ConsultEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public ConsultEntityFactory() : base("ConsultEntity", MyHealthOnline.Dal.Generated.EntityType.ConsultEntity) { }

		/// <summary>Creates a new, empty ConsultEntity object.</summary>
		/// <returns>A new, empty ConsultEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new ConsultEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewConsult
			// __LLBLGENPRO_USER_CODE_REGION_END
			
			return toReturn;
		}


		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty ConsultQuestionEntity objects.</summary>
	[Serializable]
	public partial class ConsultQuestionEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public ConsultQuestionEntityFactory() : base("ConsultQuestionEntity", MyHealthOnline.Dal.Generated.EntityType.ConsultQuestionEntity) { }

		/// <summary>Creates a new, empty ConsultQuestionEntity object.</summary>
		/// <returns>A new, empty ConsultQuestionEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new ConsultQuestionEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewConsultQuestion
			// __LLBLGENPRO_USER_CODE_REGION_END
			
			return toReturn;
		}


		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty DateQuestionEntity objects.</summary>
	[Serializable]
	public partial class DateQuestionEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public DateQuestionEntityFactory() : base("DateQuestionEntity", MyHealthOnline.Dal.Generated.EntityType.DateQuestionEntity) { }

		/// <summary>Creates a new, empty DateQuestionEntity object.</summary>
		/// <returns>A new, empty DateQuestionEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new DateQuestionEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewDateQuestion
			// __LLBLGENPRO_USER_CODE_REGION_END
			
			return toReturn;
		}


		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty DisciplineEntity objects.</summary>
	[Serializable]
	public partial class DisciplineEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public DisciplineEntityFactory() : base("DisciplineEntity", MyHealthOnline.Dal.Generated.EntityType.DisciplineEntity) { }

		/// <summary>Creates a new, empty DisciplineEntity object.</summary>
		/// <returns>A new, empty DisciplineEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new DisciplineEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewDiscipline
			// __LLBLGENPRO_USER_CODE_REGION_END
			
			return toReturn;
		}


		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty MessageEntity objects.</summary>
	[Serializable]
	public partial class MessageEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public MessageEntityFactory() : base("MessageEntity", MyHealthOnline.Dal.Generated.EntityType.MessageEntity) { }

		/// <summary>Creates a new, empty MessageEntity object.</summary>
		/// <returns>A new, empty MessageEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new MessageEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewMessage
			// __LLBLGENPRO_USER_CODE_REGION_END
			
			return toReturn;
		}


		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty MultiChoiceQuestionEntity objects.</summary>
	[Serializable]
	public partial class MultiChoiceQuestionEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public MultiChoiceQuestionEntityFactory() : base("MultiChoiceQuestionEntity", MyHealthOnline.Dal.Generated.EntityType.MultiChoiceQuestionEntity) { }

		/// <summary>Creates a new, empty MultiChoiceQuestionEntity object.</summary>
		/// <returns>A new, empty MultiChoiceQuestionEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new MultiChoiceQuestionEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewMultiChoiceQuestion
			// __LLBLGENPRO_USER_CODE_REGION_END
			
			return toReturn;
		}


		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty OpenQuestionEntity objects.</summary>
	[Serializable]
	public partial class OpenQuestionEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public OpenQuestionEntityFactory() : base("OpenQuestionEntity", MyHealthOnline.Dal.Generated.EntityType.OpenQuestionEntity) { }

		/// <summary>Creates a new, empty OpenQuestionEntity object.</summary>
		/// <returns>A new, empty OpenQuestionEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new OpenQuestionEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewOpenQuestion
			// __LLBLGENPRO_USER_CODE_REGION_END
			
			return toReturn;
		}


		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty PatientEntity objects.</summary>
	[Serializable]
	public partial class PatientEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public PatientEntityFactory() : base("PatientEntity", MyHealthOnline.Dal.Generated.EntityType.PatientEntity) { }

		/// <summary>Creates a new, empty PatientEntity object.</summary>
		/// <returns>A new, empty PatientEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new PatientEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewPatient
			// __LLBLGENPRO_USER_CODE_REGION_END
			
			return toReturn;
		}


		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty QuestionEntity objects.</summary>
	[Serializable]
	public partial class QuestionEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public QuestionEntityFactory() : base("QuestionEntity", MyHealthOnline.Dal.Generated.EntityType.QuestionEntity) { }

		/// <summary>Creates a new, empty QuestionEntity object.</summary>
		/// <returns>A new, empty QuestionEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new QuestionEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewQuestion
			// __LLBLGENPRO_USER_CODE_REGION_END
			
			return toReturn;
		}


		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty QuestionnaireEntity objects.</summary>
	[Serializable]
	public partial class QuestionnaireEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public QuestionnaireEntityFactory() : base("QuestionnaireEntity", MyHealthOnline.Dal.Generated.EntityType.QuestionnaireEntity) { }

		/// <summary>Creates a new, empty QuestionnaireEntity object.</summary>
		/// <returns>A new, empty QuestionnaireEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new QuestionnaireEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewQuestionnaire
			// __LLBLGENPRO_USER_CODE_REGION_END
			
			return toReturn;
		}


		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty QuestionnaireQuestionEntity objects.</summary>
	[Serializable]
	public partial class QuestionnaireQuestionEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public QuestionnaireQuestionEntityFactory() : base("QuestionnaireQuestionEntity", MyHealthOnline.Dal.Generated.EntityType.QuestionnaireQuestionEntity) { }

		/// <summary>Creates a new, empty QuestionnaireQuestionEntity object.</summary>
		/// <returns>A new, empty QuestionnaireQuestionEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new QuestionnaireQuestionEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewQuestionnaireQuestion
			// __LLBLGENPRO_USER_CODE_REGION_END
			
			return toReturn;
		}


		#region Included Code

		#endregion
	}
	
	/// <summary>Factory to create new, empty SpecialistEntity objects.</summary>
	[Serializable]
	public partial class SpecialistEntityFactory : EntityFactoryBase {
		/// <summary>CTor</summary>
		public SpecialistEntityFactory() : base("SpecialistEntity", MyHealthOnline.Dal.Generated.EntityType.SpecialistEntity) { }

		/// <summary>Creates a new, empty SpecialistEntity object.</summary>
		/// <returns>A new, empty SpecialistEntity object.</returns>
		public override IEntity Create() {
			IEntity toReturn = new SpecialistEntity();
			
			// __LLBLGENPRO_USER_CODE_REGION_START CreateNewSpecialist
			// __LLBLGENPRO_USER_CODE_REGION_END
			
			return toReturn;
		}


		#region Included Code

		#endregion
	}

	/// <summary>Factory to create new entity collection objects</summary>
	[Serializable]
	public partial class GeneralEntityCollectionFactory
	{
		/// <summary>Creates a new entity collection</summary>
		/// <param name="typeToUse">The entity type to create the collection for.</param>
		/// <returns>A new entity collection object.</returns>
		public static IEntityCollection Create(MyHealthOnline.Dal.Generated.EntityType typeToUse)
		{
			switch(typeToUse)
			{
				case MyHealthOnline.Dal.Generated.EntityType.AdministratorEntity:
					return new AdministratorCollection();
				case MyHealthOnline.Dal.Generated.EntityType.AppProposalEntity:
					return new AppProposalCollection();
				case MyHealthOnline.Dal.Generated.EntityType.ConsultEntity:
					return new ConsultCollection();
				case MyHealthOnline.Dal.Generated.EntityType.ConsultQuestionEntity:
					return new ConsultQuestionCollection();
				case MyHealthOnline.Dal.Generated.EntityType.DateQuestionEntity:
					return new DateQuestionCollection();
				case MyHealthOnline.Dal.Generated.EntityType.DisciplineEntity:
					return new DisciplineCollection();
				case MyHealthOnline.Dal.Generated.EntityType.MessageEntity:
					return new MessageCollection();
				case MyHealthOnline.Dal.Generated.EntityType.MultiChoiceQuestionEntity:
					return new MultiChoiceQuestionCollection();
				case MyHealthOnline.Dal.Generated.EntityType.OpenQuestionEntity:
					return new OpenQuestionCollection();
				case MyHealthOnline.Dal.Generated.EntityType.PatientEntity:
					return new PatientCollection();
				case MyHealthOnline.Dal.Generated.EntityType.QuestionEntity:
					return new QuestionCollection();
				case MyHealthOnline.Dal.Generated.EntityType.QuestionnaireEntity:
					return new QuestionnaireCollection();
				case MyHealthOnline.Dal.Generated.EntityType.QuestionnaireQuestionEntity:
					return new QuestionnaireQuestionCollection();
				case MyHealthOnline.Dal.Generated.EntityType.SpecialistEntity:
					return new SpecialistCollection();
				default:
					return null;
			}
		}		
	}
	
	/// <summary>Factory to create new, empty Entity objects based on the entity type specified. Uses entity specific factory objects</summary>
	[Serializable]
	public partial class GeneralEntityFactory
	{
		/// <summary>Creates a new, empty Entity object of the type specified</summary>
		/// <param name="entityTypeToCreate">The entity type to create.</param>
		/// <returns>A new, empty Entity object.</returns>
		public static IEntity Create(MyHealthOnline.Dal.Generated.EntityType entityTypeToCreate)
		{
			IEntityFactory factoryToUse = null;
			switch(entityTypeToCreate)
			{
				case MyHealthOnline.Dal.Generated.EntityType.AdministratorEntity:
					factoryToUse = new AdministratorEntityFactory();
					break;
				case MyHealthOnline.Dal.Generated.EntityType.AppProposalEntity:
					factoryToUse = new AppProposalEntityFactory();
					break;
				case MyHealthOnline.Dal.Generated.EntityType.ConsultEntity:
					factoryToUse = new ConsultEntityFactory();
					break;
				case MyHealthOnline.Dal.Generated.EntityType.ConsultQuestionEntity:
					factoryToUse = new ConsultQuestionEntityFactory();
					break;
				case MyHealthOnline.Dal.Generated.EntityType.DateQuestionEntity:
					factoryToUse = new DateQuestionEntityFactory();
					break;
				case MyHealthOnline.Dal.Generated.EntityType.DisciplineEntity:
					factoryToUse = new DisciplineEntityFactory();
					break;
				case MyHealthOnline.Dal.Generated.EntityType.MessageEntity:
					factoryToUse = new MessageEntityFactory();
					break;
				case MyHealthOnline.Dal.Generated.EntityType.MultiChoiceQuestionEntity:
					factoryToUse = new MultiChoiceQuestionEntityFactory();
					break;
				case MyHealthOnline.Dal.Generated.EntityType.OpenQuestionEntity:
					factoryToUse = new OpenQuestionEntityFactory();
					break;
				case MyHealthOnline.Dal.Generated.EntityType.PatientEntity:
					factoryToUse = new PatientEntityFactory();
					break;
				case MyHealthOnline.Dal.Generated.EntityType.QuestionEntity:
					factoryToUse = new QuestionEntityFactory();
					break;
				case MyHealthOnline.Dal.Generated.EntityType.QuestionnaireEntity:
					factoryToUse = new QuestionnaireEntityFactory();
					break;
				case MyHealthOnline.Dal.Generated.EntityType.QuestionnaireQuestionEntity:
					factoryToUse = new QuestionnaireQuestionEntityFactory();
					break;
				case MyHealthOnline.Dal.Generated.EntityType.SpecialistEntity:
					factoryToUse = new SpecialistEntityFactory();
					break;
			}
			IEntity toReturn = null;
			if(factoryToUse != null)
			{
				toReturn = factoryToUse.Create();
			}
			return toReturn;
		}		
	}
	
	/// <summary>Class which is used to obtain the entity factory based on the .NET type of the entity. </summary>
	[Serializable]
	public static class EntityFactoryFactory
	{
#if CF
		/// <summary>Gets the factory of the entity with the MyHealthOnline.Dal.Generated.EntityType specified</summary>
		/// <param name="typeOfEntity">The type of entity.</param>
		/// <returns>factory to use or null if not found</returns>
		public static IEntityFactory GetFactory(MyHealthOnline.Dal.Generated.EntityType typeOfEntity)
		{
			return GeneralEntityFactory.Create(typeOfEntity).GetEntityFactory();
		}
#else
		private static readonly Dictionary<Type, IEntityFactory> _factoryPerType = new Dictionary<Type, IEntityFactory>();

		/// <summary>Initializes the <see cref="EntityFactoryFactory"/> class.</summary>
		static EntityFactoryFactory()
		{
			Array entityTypeValues = Enum.GetValues(typeof(MyHealthOnline.Dal.Generated.EntityType));
			foreach(int entityTypeValue in entityTypeValues)
			{
				IEntity dummy = GeneralEntityFactory.Create((MyHealthOnline.Dal.Generated.EntityType)entityTypeValue);
				_factoryPerType.Add(dummy.GetType(), dummy.GetEntityFactory());
			}
		}

		/// <summary>Gets the factory of the entity with the .NET type specified</summary>
		/// <param name="typeOfEntity">The type of entity.</param>
		/// <returns>factory to use or null if not found</returns>
		public static IEntityFactory GetFactory(Type typeOfEntity)
		{
			IEntityFactory toReturn = null;
			_factoryPerType.TryGetValue(typeOfEntity, out toReturn);
			return toReturn;
		}

		/// <summary>Gets the factory of the entity with the MyHealthOnline.Dal.Generated.EntityType specified</summary>
		/// <param name="typeOfEntity">The type of entity.</param>
		/// <returns>factory to use or null if not found</returns>
		public static IEntityFactory GetFactory(MyHealthOnline.Dal.Generated.EntityType typeOfEntity)
		{
			return GetFactory(GeneralEntityFactory.Create(typeOfEntity).GetType());
		}
#endif
	}
	
	/// <summary>Element creator for creating project elements from somewhere else, like inside Linq providers.</summary>
	public class ElementCreator : ElementCreatorBase, IElementCreator
	{
		/// <summary>Gets the factory of the Entity type with the MyHealthOnline.Dal.Generated.EntityType value passed in</summary>
		/// <param name="entityTypeValue">The entity type value.</param>
		/// <returns>the entity factory of the entity type or null if not found</returns>
		public IEntityFactory GetFactory(int entityTypeValue)
		{
			return (IEntityFactory)this.GetFactoryImpl(entityTypeValue);
		}

		/// <summary>Gets the factory of the Entity type with the .NET type passed in</summary>
		/// <param name="typeOfEntity">The type of entity.</param>
		/// <returns>the entity factory of the entity type or null if not found</returns>
		public IEntityFactory GetFactory(Type typeOfEntity)
		{
			return (IEntityFactory)this.GetFactoryImpl(typeOfEntity);
		}

		/// <summary>Creates a new resultset fields object with the number of field slots reserved as specified</summary>
		/// <param name="numberOfFields">The number of fields.</param>
		/// <returns>ready to use resultsetfields object</returns>
		public IEntityFields CreateResultsetFields(int numberOfFields)
		{
			return new ResultsetFields(numberOfFields);
		}
		
		/// <summary>Gets an instance of the TypedListDAO class to execute dynamic lists and projections.</summary>
		/// <returns>ready to use typedlistDAO</returns>
		public IDao GetTypedListDao()
		{
			return new TypedListDAO();
		}
		
		/// <summary>Creates a new dynamic relation instance</summary>
		/// <param name="leftOperand">The left operand.</param>
		/// <returns>ready to use dynamic relation</returns>
		public override IDynamicRelation CreateDynamicRelation(DerivedTableDefinition leftOperand)
		{
			return new DynamicRelation(leftOperand);
		}

		/// <summary>Creates a new dynamic relation instance</summary>
		/// <param name="leftOperand">The left operand.</param>
		/// <param name="joinType">Type of the join. If None is specified, Inner is assumed.</param>
		/// <param name="rightOperand">The right operand.</param>
		/// <param name="onClause">The on clause for the join.</param>
		/// <returns>ready to use dynamic relation</returns>
		public override IDynamicRelation CreateDynamicRelation(DerivedTableDefinition leftOperand, JoinHint joinType, DerivedTableDefinition rightOperand, IPredicate onClause)
		{
			return new DynamicRelation(leftOperand, joinType, rightOperand, onClause);
		}

		/// <summary>Creates a new dynamic relation instance</summary>
		/// <param name="leftOperand">The left operand.</param>
		/// <param name="joinType">Type of the join. If None is specified, Inner is assumed.</param>
		/// <param name="rightOperandEntityName">Name of the entity, which is used as the right operand.</param>
		/// <param name="aliasRightOperand">The alias of the right operand. If you don't want to / need to alias the right operand (only alias if you have to), specify string.Empty.</param>
		/// <param name="onClause">The on clause for the join.</param>
		/// <returns>ready to use dynamic relation</returns>
		public override IDynamicRelation CreateDynamicRelation(DerivedTableDefinition leftOperand, JoinHint joinType, string rightOperandEntityName, string aliasRightOperand, IPredicate onClause)
		{
			return new DynamicRelation(leftOperand, joinType, (MyHealthOnline.Dal.Generated.EntityType)Enum.Parse(typeof(MyHealthOnline.Dal.Generated.EntityType), rightOperandEntityName, false), aliasRightOperand, onClause);
		}

		/// <summary>Creates a new dynamic relation instance</summary>
		/// <param name="leftOperandEntityName">Name of the entity which is used as the left operand.</param>
		/// <param name="joinType">Type of the join. If None is specified, Inner is assumed.</param>
		/// <param name="rightOperandEntityName">Name of the entity, which is used as the right operand.</param>
		/// <param name="aliasLeftOperand">The alias of the left operand. If you don't want to / need to alias the right operand (only alias if you have to), specify string.Empty.</param>
		/// <param name="aliasRightOperand">The alias of the right operand. If you don't want to / need to alias the right operand (only alias if you have to), specify string.Empty.</param>
		/// <param name="onClause">The on clause for the join.</param>
		/// <returns>ready to use dynamic relation</returns>
		public override IDynamicRelation CreateDynamicRelation(string leftOperandEntityName, JoinHint joinType, string rightOperandEntityName, string aliasLeftOperand, string aliasRightOperand, IPredicate onClause)
		{
			return new DynamicRelation((MyHealthOnline.Dal.Generated.EntityType)Enum.Parse(typeof(MyHealthOnline.Dal.Generated.EntityType), leftOperandEntityName, false), joinType, (MyHealthOnline.Dal.Generated.EntityType)Enum.Parse(typeof(MyHealthOnline.Dal.Generated.EntityType), rightOperandEntityName, false), aliasLeftOperand, aliasRightOperand, onClause);
		}
				
		/// <summary>Obtains the inheritance info provider instance from the singleton </summary>
		/// <returns>The singleton instance of the inheritance info provider</returns>
		public override IInheritanceInfoProvider ObtainInheritanceInfoProviderInstance()
		{
			return InheritanceInfoProviderSingleton.GetInstance();
		}

		/// <summary>Implementation of the routine which gets the factory of the Entity type with the MyHealthOnline.Dal.Generated.EntityType value passed in</summary>
		/// <param name="entityTypeValue">The entity type value.</param>
		/// <returns>the entity factory of the entity type or null if not found</returns>
		protected override IEntityFactoryCore GetFactoryImpl(int entityTypeValue)
		{
			return EntityFactoryFactory.GetFactory((MyHealthOnline.Dal.Generated.EntityType)entityTypeValue);
		}
#if !CF		
		/// <summary>Implementation of the routine which gets the factory of the Entity type with the .NET type passed in</summary>
		/// <param name="typeOfEntity">The type of entity.</param>
		/// <returns>the entity factory of the entity type or null if not found</returns>
		protected override IEntityFactoryCore GetFactoryImpl(Type typeOfEntity)
		{
			return EntityFactoryFactory.GetFactory(typeOfEntity);
		}
#endif
	}
}
